<template>
  <div>
    <!--title-->
    <div class="content-title" ref="title">
      <div class="su-title">
        <i class="el-icon-tickets"> </i>
        <span>我的租户信息</span>
      </div>
      <div class="batch-but-css">
        <!--<el-button type="danger" icon="el-icon-refresh el-icon&#45;&#45;left" @click="tabsOrTableDialogEmpty">清空设置</el-button>-->
      </div>
    </div>
    <div style="width: 500px">
      <el-form :model="formData" ref="drawerFrom0" class="common-drawer-edit">
        <el-form-item label="租户名称" prop="name" class="common-drawer-edit-li li2" :rules="[]">
          <el-input placeholder="请输入租户名称" v-model="formData.name" :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="企业类型" prop="warnCheckendDay" class="common-drawer-edit-li li2" :rules="[]">

            <el-select placeholder="请选择企业类型" v-model="formData.businessType" filterable clearable
                       :disabled="viewsStatues">
              <el-option v-for="item in businessTypeOption" :key="item.value"
                         :label="item.label" :value="item.value"/>
            </el-select>
        </el-form-item>
        <el-form-item label="统一社会信用代码" prop="creditId" class="common-drawer-edit-li li2" :rules="[]">
          <el-input placeholder="请输入统一社会信用代码" v-model="formData.creditId" :disabled="viewsStatues"
                    clearable/>
        </el-form-item>
        <el-form-item label="纳税人识别号" prop="taxpayerId"
                      class="common-drawer-edit-li li2" :rules="[]">
          <el-input placeholder="请输入纳税人识别号" v-model="formData.taxpayerId"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="企业法人/经营者" prop="manager" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入企业法人/经营者" v-model="formData.manager"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="省份" prop="province" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入省份" v-model="formData.province"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="城市" prop="city" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入省份" v-model="formData.city"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="区县" prop="county" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入省份" v-model="formData.county"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="地址" prop="address" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入地址" v-model="formData.address"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="联系人" prop="contact" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入地址" v-model="formData.contact"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item label="联系电话" prop="contactPhone" class="common-drawer-edit-li li2"
                      :rules="[]">
          <el-input placeholder="请输入地址" v-model="formData.contactPhone"
                    :disabled="viewsStatues" clearable/>
        </el-form-item>
        <el-form-item prop="" class="bottomBtn li2" :rules="[]" v-if="!viewsStatues">
          <el-button icon="el-icon-close el-icon--left" @click="viewsStatues = !viewsStatues">取 消</el-button>
          <el-button type="primary" icon="el-icon-check el-icon--left" @click="drawerSubmitForm">保 存</el-button>
        </el-form-item>
        <el-form-item  prop="" class="li2 bottomBtn" :rules="[]" v-if="viewsStatues">
          <el-button type="primary" icon="el-icon-check el-icon--left" @click="viewsStatues = !viewsStatues">编辑
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>


export default {
  components: {},
  props: [],
  data() {
    return {
      businessTypeOption:[],
      viewsStatues: true,
      formData: {
        businessType: '',
        name: '',
        creditId: '',
        taxpayerId: '',
        manager: '',
        province: '',
        city: '',
        county: '',
        address: '',
        contact: '',
        contactPhone: '',
      }
    };
  },
  created() {
    this.businessTypeOption = this.$getDictData('business_type')
    this.$userInfo({adminId:window.sessionStorage.getItem('id')}).then(res => {
      this.formData = JSON.parse(JSON.stringify(res.data))
      console.log(this.formData,'123')
    })


  },
  activated() {
  },
  mounted() {
  },
  methods: {
    drawerSubmitForm() {
      this.$userUpdate(this.formData).then(()=>{
        this.$message.success('编辑成功');
        this.viewsStatues = true
      })
    },
  },
};
</script>
<style lang="scss" scoped>
span {
  max-width: 1000px;
}

.bottomBtn {
  display: flex;
  flex-direction: row-reverse;
  //padding-left: 40px;
}
::v-deep .el-form-item__label {
  width: 130px !important;
}
</style>
